package com.mao.crowd.api;

import com.mao.crowd.util.ResultEntity;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.concurrent.TimeUnit;

/**
 * @author: Administrator
 * @description:
 * @cteate 2021-06-18-20:43
 */
@FeignClient("mao-crowd-redis")
public interface RedisRemoteService {

    /**
     * 不带超时时间的String类型set方法
     * @param key
     * @param value
     * @return
     */
    @RequestMapping("/set/redis/key/value/remote")
    ResultEntity<String> setRedisKeyValueRemote(
            @RequestParam("key") String key,
            @RequestParam("value") String value);

    /**
     * 带超时时间的String类型set方法
     * @param key
     * @param value
     * @return
     */
    @RequestMapping("/set/redis/key/value/remote/with/time/out")
    ResultEntity<String> setRedisKeyValueRemoteWithTimeOut(
            @RequestParam("key") String key,
            @RequestParam("value") String value,
            @RequestParam("time") long time,
            @RequestParam("timeUnit") TimeUnit timeUnit);

    @RequestMapping("/get/redis/value/by/key")
    ResultEntity<String> getRedisValueByKey(
            @RequestParam("key") String key);

    @RequestMapping("/remove/redis/value/by/key")
    ResultEntity<String> removeRedisValueByKey(
            @RequestParam("key") String key);
}

